package com.ehotting.edsta.diagnosisPredict.feign.factory;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.ProjectDto;
import com.ehotting.edsta.diagnosisPredict.domain.dto.ProjectSearchDto;
import com.ehotting.edsta.diagnosisPredict.feign.ModelManagerFeignService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 模型管理降级处理
 * 
 * @author edsta
 */
@Component
public class ModelManagerFallbackFactory implements FallbackFactory<ModelManagerFeignService>
{
    private static final Logger log = LoggerFactory.getLogger(ModelManagerFallbackFactory.class);

    @Override
    public ModelManagerFeignService create(Throwable throwable)
    {
        log.error("模型管理调用失败:{}", throwable.getMessage());
        return new ModelManagerFeignService()
        {

            @Override
            public Response<PageDto<ProjectDto>> searchPage(ProjectSearchDto projectSearchDto) {
                return null;
            }

            @Override
            public Response<Boolean> batch(long[] idList) {
                return null;
            }

            @Override
            public Response<ProjectDto> get(Long id) {
                return null;
            }

            @Override
            public Response<ProjectDto> projectSave(ProjectDto dto) {
                return null;
            }
        };
    }
}
